export const useAuthRouter = (url, params = {}, type = 'navigateTo') => {
	try {
		const token = uni.getStorageSync('token')
		if (!token){
			uni.navigateTo({
				url:'/pages/login/index'
			})
			return
		}
		if (Object.keys(params).length) url = `${url}?data=${encodeURIComponent(JSON.stringify(params))}`
		if (type === 'navigateBack') {
			uni[type]({ delta: url })
		} else {
			uni[type]({ url })
		}
	} catch (error) {
		console.error(error)
	}
}